package day1103.demo04;

import java.util.function.Consumer;

/**
 * @program: qy151-jdk8
 * @description:
 * @author: 闫克起2
 * @create: 2022-07-19 16:56
 **/
public class Test01 {

    public static void main(String[] args) {
        Consumer<Integer[]> c=Test01::sum;
        fun(c);
    }


    public static void fun(Consumer<Integer[]>  consumer){
          Integer[] arr={1,2,3,4,5};
          consumer.accept(arr);
    }

    public static void sum(Integer[] arr){
          int sum=0;
          for (int a:arr){
              sum+=a;
          }
        System.out.println("数组的和为:"+sum);
    }

}
